package com.atiguigu.rabbitmq.eight;

import com.atiguigu.rabbitmq.utils.RabbitMqUtils;
import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DeliverCallback;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeoutException;

/*
* 死信队列实战
* */
public class Consumer02 {

    public static final String DEAD_QUEUE= "dead_queue";//死信队列

    public static void main(String[] args) throws IOException, TimeoutException {
       Channel channel = RabbitMqUtils.getChannel();


        System.out.println("等待接收消息。。。");
        DeliverCallback deliverCallback=(consumerTag,message)->{
            System.out.println("Consumer02接收消息："+new String(message.getBody(),"UTF-8"));
        };

       channel.basicConsume(DEAD_QUEUE,true,deliverCallback,consumerTag->{});
    }
}
